/*
* @Author: Rosen
* @Date:   2017-05-08 22:26:19
* @Last Modified by:   Administrator
* @Last Modified time: 2017-11-16 14:22:24
*/

$(function(){

    $("footer").load("layout/footer.html");
    $("header").load("layout/header2.html");
    

    $("#loginbtn").click(function(){


    	if($("#username").val()==""||$("#password").val()==""){
              $(".err-msg").find(".error").html("用户名或密码不能为空")
              $(".err-msg").fadeIn().fadeOut().fadeIn()
          }
          else {
          	$(".err-msg").fadeOut();
          	var name=$("#username").val();
          	var pwd=$("#password").val();
          	var users={};
          	users.phone=name;
          	users.password=pwd;
          	users.userID="555";
          	users.modifyDate="2010-12-30";
	    	 $.ajax({
	                     type:"post",
	                     url:"/SST/user/login.do",
	                     async:true,
	                     dataType: 'json',
	                     contentType: "application/json",
	                     data:JSON.stringify(users),
	                     success: function(res){
	                    	 alert(res);
	                        if(res==0){
									alert("登录信息正确");
									window.location.href="/SST/u/index.do";
							}else{
									alert("登录信息错误");
							}
	                     },
	                     error: function(){
	                       alert("请刷新重试")
	                     }
	                });
    	}
    })
    
})
